<?php
$this->breadcrumbs = array(
    'people' => array('index'),
    'Manage',
);

$this->menu = array(
    array('label' => '显示 联络人', 'url' => array('index')),
    array('label' => '新建 联络人', 'url' => array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('person-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>管理联络人</h1>

<p>
    你可以在标题栏下面搜索框使用  (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
    or <b>=</b>) 比较进行查找.
</p>

<?php echo CHtml::link('高级 搜索', '#', array('class' => 'search-button')); ?>
<div class="search-form" style="display:none">
    <?php
    $this->renderPartial('_search', array(
        'model' => $model,
    ));
    ?>
</div><!-- search-form -->

<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'person-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        'id',
        array(// display 'department.name' using an expression
            'header' => '部门',
            'name' => 'departmentId',
            'value' => '$data->department->name',
            'filter' => CHtml::listData(Department::model()->findAll(), 'id', 'name'),
            'headerHtmlOptions' => array('width' => '70'),
            'htmlOptions' => array('align' => 'center'),
        ),
        array(// display 'door.name' using an expression
            'header' => '职称',
            'name' => 'titleID',
            'value' => '$data->title->name',
            'filter' => CHtml::listData(Title::model()->findAll(), 'id', 'name'),
            'headerHtmlOptions' => array('width' => '70'),
            'htmlOptions' => array('align' => 'center'),
        ),
        'name',
        'mobile',
        'Ext',
        array(
            'name' => 'image',
            'type' => 'html',
            // 'value' => 'CHtml::image("images/123.jpg","", array("width"=>25))',//显示图片
            // 'value' => 'CHtml::image("images/"."$data->image","", array("width"=>25))',//显示图片
            'value' => 'CHtml::link(CHtml::image("images/"."$data->image",$data->image,array("width"=>20)),array("view", "id"=>$data->id))', //图片添加链接
        ),
        /*
          'short',
          'skype',
          'mail',
          'memo',
         */
        array(
            'class' => 'CButtonColumn',
        ),
    ),
));
?>
